using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Data;

namespace Dimok.Aspx.Manager.Lib.Controls {
	public partial class BlackBook : System.Web.UI.UserControl {
		protected Literal ltrCarPrices;
		string _vin = "";
		public string VIN { get { return _vin; } set { _vin = value; InitUI(); } }
		string _loadVIN = "";
		public string LoadVIN { get { return _loadVIN; } set { _loadVIN = value; } }

		protected override void OnPreRender(EventArgs e) {
			Page_AL pageAL = this.Page as Page_AL; UOX uox = pageAL == null ? new UOX() : pageAL.uox;
			if (VIN == "") VIN = Attributes["VIN"] + "";
			if (LoadVIN == "") LoadVIN = Attributes["LoadVIN"] + "";
			if (VIN != "") Attributes["VIN"] = VIN;
			if (LoadVIN != "") Attributes["LoadVIN"] = LoadVIN;

			Dimok.BlackBook.PriceInfoDS dsPI = uox.BB.PriceInfo(VIN);
			//ltrCarPrices.Text = SQL.XmlInnerText(dsPI.BookValue);
			//dsPI.Tables.Remove(dsPI.BookValue);
			ltrCar.Text = SQL.XmlInnerText(dsPI);

			ltrYears.Text = SQL.ExecuteScalarArray("SELECT Year FROM dbo.Car_Years() ORDER BY Year DESC").Join("~");

			ltrAttrs.Text = User.UserPage.BuildAttributes(Attributes);
			base.OnPreRender(e);
		}
		void InitUI(){
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e) {
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent() {
		}
		#endregion
	}
}
